$(document).ready(function() {
	
	$.ajax({
		url: "/message",
		success: function(data) {
			var result = data;
			var dianzan = result.count.dianzan;

			var pinglun = result.pl;

			var myChart = echarts.init(document.getElementById('main'));

			// 指定图表的配置项和数据
			var option = {
				title: {
					text: '评论点赞统计'
				},
				tooltip: {},
				legend: {
					data: ['总数']
				},
				xAxis: {
					data: ["点赞", "评论"]
				},
				yAxis: {},
				series: [{
					name: '总数',
					type: 'bar',
					data: [dianzan, pinglun]
				}]
			};
			// 使用刚指定的配置项和数据显示图表。
			myChart.setOption(option);

		}

	});
})



function showUser() {

	$.ajax({
		url: "/user/showUserNameOnLine",
		success: function(data) {
			$("#showUser").html("当前用户:"+data.username);

		}
	})

}